package com.github.cakin.shiro.chapter20.realm;

import org.apache.shiro.authc.AuthenticationToken;

import java.util.Map;

/**
 * @className: StatelessToken
 * @description: 认证token
 * @date: 2020/5/29
 * @author: cakin
 */
public class StatelessToken implements AuthenticationToken {
    /**
     * 用户名 用户身份即用户名
     */
    private String username;
    /**
     * 客户端带过来的参数，但不包括消息摘要
     */
    private Map<String, ?> params;
    /**
     * 客户端消息摘要 凭证即客户端传入的消息摘要。
     */
    private String clientDigest;

    public StatelessToken( String username, Map<String, ?> params, String clientDigest ) {
        this.username = username;
        this.params = params;
        this.clientDigest = clientDigest;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername( String username ) {
        this.username = username;
    }

    public Map<String, ?> getParams() {
        return params;
    }

    public void setParams( Map<String, ?> params ) {
        this.params = params;
    }

    public String getClientDigest() {
        return clientDigest;
    }

    public void setClientDigest( String clientDigest ) {
        this.clientDigest = clientDigest;
    }

    public Object getPrincipal() {
        return username;
    }

    public Object getCredentials() {
        return clientDigest;
    }
}
